package com.ruoyi.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.response.OutboundDetailList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.OutboundInfoMapper;
import com.ruoyi.system.domain.OutboundInfo;
import com.ruoyi.system.service.IOutboundInfoService;
import com.ruoyi.common.core.text.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 出库领料详情Service业务层处理
 *
 * @author tanshen
 * @date 2023-08-26
 */
@Service
public class OutboundInfoServiceImpl extends ServiceImpl<OutboundInfoMapper, OutboundInfo> implements IOutboundInfoService {
    @Autowired
    private OutboundInfoMapper outboundInfoMapper;

    /**
     * 查询出库领料详情
     *
     * @param id 出库领料详情主键
     * @return 出库领料详情
     */
    @Override
    public OutboundInfo selectOutboundInfoById(Long id) {
        return outboundInfoMapper.selectOutboundInfoById(id);
    }

    /**
     * 查询出库领料详情列表
     *
     * @param outboundInfo 出库领料详情
     * @return 出库领料详情
     */
    @Override
    public List<OutboundInfo> selectOutboundInfoList(OutboundInfo outboundInfo) {
        return outboundInfoMapper.selectOutboundInfoList(outboundInfo);
    }

    /**
     * 新增出库领料详情
     *
     * @param outboundInfo 出库领料详情
     * @return 结果
     */
    @Override
    public int insertOutboundInfo(OutboundInfo outboundInfo) {
        outboundInfo.setCreateTime(DateUtils.getNowDate());
        return outboundInfoMapper.insertOutboundInfo(outboundInfo);
    }

    /**
     * 修改出库领料详情
     *
     * @param outboundInfo 出库领料详情
     * @return 结果
     */
    @Override
    public int updateOutboundInfo(OutboundInfo outboundInfo) {
        outboundInfo.setUpdateTime(DateUtils.getNowDate());
        return outboundInfoMapper.updateOutboundInfo(outboundInfo);
    }

    /**
     * 批量删除出库领料详情
     *
     * @param ids 需要删除的出库领料详情主键
     * @return 结果
     */
    @Override
    public int deleteOutboundInfoByIds(String ids) {
        return outboundInfoMapper.deleteOutboundInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除出库领料详情信息
     *
     * @param id 出库领料详情主键
     * @return 结果
     */
    @Override
    public int deleteOutboundInfoById(Long id) {
        return outboundInfoMapper.deleteOutboundInfoById(id);
    }

    @Override
    public List<OutboundDetailList> detailList(String deliveryOrderId) {
        return outboundInfoMapper.detailList(deliveryOrderId);
    }
}